﻿using ConfExpert.Forms.Base;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Views.Grid;
using DevTeam;
using System;

namespace ConfExpert.Forms.Depo
{
    public partial class AkfilHistory : XForm
    {
        char Tip = 'G';
        public AkfilHistory(char _Tip)
        {
            InitializeComponent();
            Tip = _Tip;
            this.Text = "Akfil " + (Tip == 'G' ? "Giren" : "Çıkan");
        }

        private void AkfilHistory_Load(object sender, EventArgs e)
        {
            gridView1.Init("GetAkfilHistory", Tip);
            gridView1.AddSummary((Tip == 'G' ? "GelenQty" : "CikanQty"), "TopAdedi");
            gridView1.BestFitColumns();
        }

/*TODO:
 * 
As another solution, you can assign ImageComboBoxEdit as a repository item for the displaying mode. Then, handle the 
GridView.CustomRowCellEditForEditing  event and assign your GridLookUpEdit editor (see Display image in the textarea in GridLookUpEdit ). 
In this solution, the icon won't be displayed in editing mode either.
*/
        private void PrepareImageComboBoxEdit(GridView gv, string colName, string opts)
        {
            RepositoryItemImageComboBox imageCombo = gv.GridControl.RepositoryItems.Add("ImageComboBoxEdit") as RepositoryItemImageComboBox;
            imageCombo.Items.BeginUpdate();
            int ndx = 0;
            imageCombo.SmallImages = noktalar;

            foreach (string opt in opts.Split('|'))
                imageCombo.Items.Add(new ImageComboBoxItem(opt, ndx++));
            imageCombo.Items.EndUpdate();
            gv.Columns[colName].ColumnEdit = imageCombo;
        }
    }
}